#include "Player.h"
#include <stdio.h>
#include <string>
#include <sstream>
using namespace std;
void Player::update(void) {

}

list<Tile>& Player::getHandList(void) {
	return m_tilesList;
}
void Player::setHandList(list<Tile>& a_handList) {
	m_tilesList = a_handList;
}
void Player::addATileToHand(Tile tile) {
	m_tilesList.push_front(tile);
}
string Player::toString() {
	string temp;
	temp += "Player [";

	string s;
	temp += getIntToStr(m_playerID);
	temp += "] . Pos ";
	temp += m_playerLoc.toString();
	temp += " . Gold: ";
	temp += m_goldOwned.toString();

	temp += "g . Tile Info: \n";
	list<Tile>::iterator it = m_tilesList.begin();
	for(int i = 0; it != m_tilesList.end(); ++i,it++) {
		temp += it->toString();
		temp += "\n";
	}
	temp += "\n";

	return temp;
}
bool Player::movePlayer(arrowDirection dest){
	bool canMove = true;
	switch(dest){
		case UP:{
			m_playerLoc.setY(m_playerLoc.getY()-1);
			break;
			}
		case DOWN:{
			m_playerLoc.setY(m_playerLoc.getY()+1);
			break;
			}
		case RIGHT:{
			m_playerLoc.setX(m_playerLoc.getX()+1);
			break;
			}
		case LEFT:{
			m_playerLoc.setX(m_playerLoc.getX()-1);
			break;
			}
	}
	return canMove;
}

void Player::setPos(Position pos) {
	m_playerLoc = pos;
}